'use strict';

//增
function postBlog(params) {
    return new Promise(
        $.post(`${baseUrl}/Blog`, data => {
            resolve(data);
        })
    )
}

//查指定id
function getBlogById(id) {
    return new Promise(resolve, reject)(
        $.get(`${baseUrl}/Blog/${id}`, data => {
            resolve(data);
        })
    )
}

//查关键词
function getBlog(keyword) {
    return new Promise(resolve, reject)(
        $.get(`${baseUrl}/Blog?keyword + obj`, data => {
            resolve(data);
        })
    )
}

//删
function delBlogById(id) {
    return new Promise(resolve, reject)(
        {
            url: `${baseUrl}/Blog/${id}`,
            type: 'delete',
            success = {
                resolve(data)
            }
        }
    )
}

//改
function putBlogById(id) {
    return new Promise(resolve, reject)(
        {
            url: `${baseUrl}/Blog/${id}`,
            success = {
                resolve(data)
            }
        }
    )
}